<template>
  <el-dialog title="取消分配内转车"
             :visible.sync="dialogForm"
             width="1200px">
    <el-form :inline="true"
             ref="form"
             :model="form"
             class="add-form"
             label-width="110px">
      <el-row>
        <!-- <el-col :span=" 12">
          <el-form-item label="车船号:">
            {{ form.transhipNo }}
          </el-form-item>
        </el-col> -->
        <el-col :span="8">
          <el-form-item label="入库方式:">
            {{ form.inWayName }}
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="车队："
                        prop="carTeam">
            {{ form.carTeam }}
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="内转车号："
                        prop="carNo">
            {{ form.carNo }}
          </el-form-item>
        </el-col>
      </el-row>
      <el-button class="button" @click="cancelAll">全部取消</el-button>
      <el-table :data="form.detailVos"
                border
                stripe
                max-height="550">
        <el-table-column label="序号"
                         type="index"
                         width="50"></el-table-column>
        <el-table-column prop="transhipNo"
                         label="车船号"
                         min-width="100"></el-table-column>
        <el-table-column prop="cargoName"
                         label="品名"
                         min-width="100"></el-table-column>
        <el-table-column prop="normStr"
                         label="规格"
                         min-width="100"></el-table-column>
        <el-table-column prop="material"
                         label="材质"
                         min-width="100"></el-table-column>
        <el-table-column prop="madeBy"
                         label="生产厂家"
                         min-width="100"></el-table-column>
        <el-table-column prop="loadNum"
                         label="件数"
                         min-width="100"></el-table-column>
        <el-table-column prop="jobPointName"
                         label="作业点"
                         min-width="100"></el-table-column>
        <el-table-column prop="sortNo"
                         label="作业顺序"
                         min-width="100"></el-table-column>
        <el-table-column prop="jobStatus"
                         label="作业状态"
                         min-width="100">
          <template slot-scope="scope">
            {{ scope.row.jobStatus | _filterShiftStatus }}
          </template>
        </el-table-column>
        <el-table-column label="操作"
                         align="center"
                         width="100"
                         fixed="right">
          <template slot-scope="scope">
            <el-button type="text"
                       size="small"
                       :disabled="scope.row.jobStatus !== 'NOOPERATE'"
                       @click="handleCancelDialogForm(scope.row)">取消</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-form>
    <span slot="footer"
          class="dialog-footer">
      <el-button @click="dialogForm = false">返 回</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { cancelDetailCar } from '@/api/accept/carry'

export default {
  name: 'cancelDistributeCarForm',
  data() {
    return {
      form: this.clearForm(),
      dialogForm: false,
      condition: {} // 查询条件
    }
  },
  mounted() {},
  methods: {
    clearForm() {
      return {
        baseVos: [],
        carNo: '',
        carTeam: '',
        planNo: ''
      }
    },
    //取消
    handleCancelDialogForm(item) {
      console.log('取消', item)
      cancelDetailCar(item.id).then(res => {
        console.log('取消', res.data)
        this.$message({
          type: 'success',
          message: `取消成功!`
        })
        this.loadData()
      })
    },
    //全部取消
    cancelAll(){

    }
  },
  watch: {
    dialogForm(val) {
      if (!val) {
        this.$refs.form.resetFields()
        this.isEdit = false
        this.form = this.clearForm()
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
